function GAD_Midazolam_Mobility_Bar_Plot(Data_Summary)
%% collect G36 saline Mobility
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'G2_F6(2)_36') && Data_Summary(n).dose==0
        G36_Saline(n,1)=Data_Summary(n).Mobility_Session1;
    end
end
G36_Saline(G36_Saline==0)=[];

%% collect G36 MIDA 0.25mg/kg Mobility
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'G2_F6(2)_36') && Data_Summary(n).dose==0.25
        G36_MIDA025(n,1)=Data_Summary(n).Mobility_Session1;
    end
end
G36_MIDA025(G36_MIDA025==0)=[];

%% collect G36 MIDA 0.25mg/kg Mobility
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'G2_F6(2)_36') && Data_Summary(n).dose==0.75
        G36_MIDA075(n,1)=Data_Summary(n).Mobility_Session1;
    end
end
G36_MIDA075(G36_MIDA075==0)=[];

%% collect G36 MIDA 1.25mg/kg Mobility
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'G2_F6(2)_36') && Data_Summary(n).dose==1.25
        G36_MIDA125(n,1)=Data_Summary(n).Mobility_Session1;
    end
end
G36_MIDA125(G36_MIDA125==0)=[];

%% collect G36 MIDA 2.5mg/kg Mobility
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'G2_F6(2)_36') && Data_Summary(n).dose==2.5
        G36_MIDA25(n,1)=Data_Summary(n).Mobility_Session1;
    end
end
G36_MIDA25(G36_MIDA25==0)=[];

%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%


%% collect G42 saline Mobility
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'G2_F6(2)_42') && Data_Summary(n).dose==0
        G42_Saline(n,1)=Data_Summary(n).Mobility_Session1;
    end
end
G42_Saline(G42_Saline==0)=[];

%% collect G42 MIDA 0.25mg/kg Mobility
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'G2_F6(2)_42') && Data_Summary(n).dose==0.25
        G42_MIDA025(n,1)=Data_Summary(n).Mobility_Session1;
    end
end
G42_MIDA025(G42_MIDA025==0)=[];

%% collect G42 MIDA 0.25mg/kg Mobility
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'G2_F6(2)_42') && Data_Summary(n).dose==0.75
        G42_MIDA075(n,1)=Data_Summary(n).Mobility_Session1;
    end
end
G42_MIDA075(G42_MIDA075==0)=[];

%% collect G42 MIDA 1.25mg/kg Mobility
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'G2_F6(2)_42') && Data_Summary(n).dose==1.25
        G42_MIDA125(n,1)=Data_Summary(n).Mobility_Session1;
    end
end
G42_MIDA125(G42_MIDA125==0)=[];

%% collect G42 MIDA 2.5mg/kg Mobility
for n=1:size(Data_Summary,2)
    if contains(Data_Summary(n).animalName,'G2_F6(2)_42') && Data_Summary(n).dose==2.5
        G42_MIDA25(n,1)=Data_Summary(n).Mobility_Session1;
    end
end
G42_MIDA25(G42_MIDA25==0)=[];

%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%

%% plotting & data organization (a5-i-WT)

WT_Saline_Summary=cat(1, [], G42_Saline);
WT_MIDA025_Summary=cat(1, [], G42_MIDA025);
WT_MIDA075_Summary=cat(1, [], G42_MIDA075);
WT_MIDA125_Summary=cat(1, [], G42_MIDA125);
WT_MIDA25_Summary=cat(1, [], G42_MIDA25);

figure
A = categorical({'Saline'});
B = categorical({'0.25'});
C = categorical({'0.75'});
D = categorical({'1.25'});
E = categorical({'2.5'});
X = cat(2,A,B,C,D,E);
% X = reordercats(X,{'Saline','0.25','0.75,','1.25','2.5'});
Y(1,1) = mean(WT_Saline_Summary(:),'omitnan');
Y(1,2) = mean(WT_MIDA025_Summary(:),'omitnan');
Y(1,3) = mean(WT_MIDA075_Summary(:),'omitnan');
Y(1,4) = mean(WT_MIDA125_Summary(:),'omitnan');
Y(1,5) = mean(WT_MIDA25_Summary(:),'omitnan');
h=bar(X(1,1),Y(1,1),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.5);
h.CData(1,:) = [0 0 1]; % color up each individual bar
ylabel('Mobility');
xlabel('Midazolam Dose (mg/kg)');
hold on
h=bar(X(1,2),Y(1,2),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.2);
h.CData(1,:) = [1 0 0]; % color up each individual bar
hold on
h=bar(X(1,3),Y(1,3),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.4);
h.CData(1,:) = [1 0 0]; % color up each individual bar
hold on
h=bar(X(1,4),Y(1,4),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.6);
h.CData(1,:) = [1 0 0]; % color up each individual bar
hold on
h=bar(X(1,5),Y(1,5),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.8);
h.CData(1,:) = [1 0 0]; % color up each individual bar
hold on
err(1,1)=calculate_standard_error(WT_Saline_Summary(:,1));
err(1,2)=calculate_standard_error(WT_MIDA025_Summary(:,1));
err(1,3)=calculate_standard_error(WT_MIDA075_Summary(:,1));
err(1,4)=calculate_standard_error(WT_MIDA125_Summary(:,1));
err(1,5)=calculate_standard_error(WT_MIDA25_Summary(:,1));
er = errorbar(X,Y,[],err,'LineWidth',2);    
er.Color = [0 0 0];                            
er.LineStyle = 'None'; 
ylim([0,1]);
set(gca,'FontSize',10);
hold on

% scatter plots with horizontal offsets - quick & dirty
% % half_num_animals_in_plot = 1;
% % initial_offset = -0.3;
% % offset = initial_offset;
% % 
% % sh = scatter(repmat(A,size(G36_Saline,1),1),G36_Saline(:,1),70,'o','k','LineWidth',2);
% % offset = offset - (initial_offset/half_num_animals_in_plot);
% % sh.XData = double(sh.XData) + offset;
% % 
% % sh = scatter(repmat(A,size(G42_Saline,1),1),G42_Saline(:,1),70,'o','b','LineWidth',2);
% % offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
% % sh.XData = double(sh.XData) + offset;
% % 
% % 
% % half_num_animals_in_plot = 1;
% % initial_offset = -0.3;
% % offset = initial_offset;
% % 
% % sh = scatter(repmat(B,size(G36_MIDA025,1),1),G36_MIDA025(:,1),70,'o','k','LineWidth',2);
% % offset = offset - (initial_offset/half_num_animals_in_plot);
% % sh.XData = double(sh.XData) + offset;
% % 
% % sh = scatter(repmat(B,size(G42_MIDA025,1),1),G42_MIDA025(:,1),70,'o','b','LineWidth',2);
% % offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
% % sh.XData = double(sh.XData) + offset;
% % 
% % 
% % half_num_animals_in_plot = 1;
% % initial_offset = -0.3;
% % offset = initial_offset;
% % 
% % sh = scatter(repmat(B,size(G36_MIDA075,1),1),G36_MIDA075(:,1),70,'o','k','LineWidth',2);
% % offset = offset - (initial_offset/half_num_animals_in_plot);
% % sh.XData = double(sh.XData) + offset;
% % 
% % sh = scatter(repmat(B,size(G42_MIDA075,1),1),G42_MIDA075(:,1),70,'o','b','LineWidth',2);
% % offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
% % sh.XData = double(sh.XData) + offset;
% % 
% % 
% % half_num_animals_in_plot = 1;
% % initial_offset = -0.3;
% % offset = initial_offset;
% % 
% % sh = scatter(repmat(E,size(G36_MIDA125,1),1),G36_MIDA125(:,1),70,'o','k','LineWidth',2);
% % offset = offset - (initial_offset/half_num_animals_in_plot);
% % sh.XData = double(sh.XData) + offset;
% % 
% % sh = scatter(repmat(E,size(G42_MIDA125,1),1),G42_MIDA125(:,1),70,'o','b','LineWidth',2);
% % offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
% % sh.XData = double(sh.XData) + offset;
% % 
% % 
% % 
% % half_num_animals_in_plot = 1;
% % initial_offset = -0.3;
% % offset = initial_offset;
% % 
% % sh = scatter(repmat(E,size(G36_MIDA25,1),1),G36_MIDA25(:,1),70,'o','k','LineWidth',2);
% % offset = offset - (initial_offset/half_num_animals_in_plot);
% % sh.XData = double(sh.XData) + offset;
% % 
% % sh = scatter(repmat(E,size(G42_MIDA25,1),1),G42_MIDA25(:,1),70,'o','b','LineWidth',2);
% % offset = offset - 0.75*(initial_offset/half_num_animals_in_plot);
% % sh.XData = double(sh.XData) + offset;


% title('C57 Midazolam DataSet Mobility','FontSize',15);

%% plotting & data organization (a5-i-KO)

MUT_Saline_Summary=cat(1, [], G36_Saline);
MUT_MIDA025_Summary=cat(1, [], G36_MIDA025);
MUT_MIDA075_Summary=cat(1, [], G36_MIDA075);
MUT_MIDA125_Summary=cat(1, [], G36_MIDA125);
MUT_MIDA25_Summary=cat(1, [], G36_MIDA25);

figure
A = categorical({'Saline'});
B = categorical({'0.25'});
C = categorical({'0.75'});
D = categorical({'1.25'});
E = categorical({'2.5'});
X = cat(2,A,B,C,D,E);
% X = reordercats(X,{'Saline','0.25','0.75,','1.25','2.5'};
Y(1,1) = mean(MUT_Saline_Summary(:),'omitnan');
Y(1,2) = mean(MUT_MIDA025_Summary(:),'omitnan');
Y(1,3) = mean(MUT_MIDA075_Summary(:),'omitnan');
Y(1,4) = mean(MUT_MIDA125_Summary(:),'omitnan');
Y(1,5) = mean(MUT_MIDA25_Summary(:),'omitnan');
h=bar(X(1,1),Y(1,1),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.5);
h.CData(1,:) = [0 0 1]; % color up each individual bar
ylabel('Mobility');
xlabel('Midazolam Dose (mg/kg)');
hold on
h=bar(X(1,2),Y(1,2),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.2);
h.CData(1,:) = [1 0 0]; % color up each individual bar
hold on
h=bar(X(1,3),Y(1,3),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.4);
h.CData(1,:) = [1 0 0]; % color up each individual bar
hold on
h=bar(X(1,4),Y(1,4),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.6);
h.CData(1,:) = [1 0 0]; % color up each individual bar
hold on
h=bar(X(1,5),Y(1,5),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.8);
h.CData(1,:) = [1 0 0]; % color up each individual bar
hold on
err(1,1)=calculate_standard_error(MUT_Saline_Summary(:,1));
err(1,2)=calculate_standard_error(MUT_MIDA025_Summary(:,1));
err(1,3)=calculate_standard_error(MUT_MIDA075_Summary(:,1));
err(1,4)=calculate_standard_error(MUT_MIDA125_Summary(:,1));
err(1,5)=calculate_standard_error(MUT_MIDA25_Summary(:,1));
er = errorbar(X,Y,[],err,'LineWidth',2);    
er.Color = [0 0 0];                            
er.LineStyle = 'None'; 
ylim([0,1]);
set(gca,'FontSize',10);
hold on

end